--[[
@FileName: LuaNGUIForm
@Date:     2018-04-10 04/10/18
@Author:   zhangpenghui
@Description:
]]

LuaNGUIForm = class("LuaNGUIForm", LuaObject)

function LuaNGUIForm:Ctor( form, uiFormParams )
	LuaNGUIForm.super.Ctor(self)

	self.form = form
	self.transform = self.form.gameObject.transform
	self.LuaScriptName = form.LuaScriptName
	self.GameObjects = form.GameObjects
	self.Transforms = form.Transforms
	self.UIPanels = form.UIPanels
	self.UILabels = form.UILabels
	self.UIButtons = form.UIButtons
	self.UIInputs = form.UIInputs
	self.UIToggles = form.UIToggles
	self.UI2DSprites = form.UI2DSprites
	self.UI2DSpriteAnimations = form.UI2DSpriteAnimations
	self.UISprites = form.UISprites
	self.UISpriteAnimations = form.UISpriteAnimations
	self.UITextures = form.UITextures
	self.UISliders = form.UISliders
	self.UIProgressBars = form.UIProgressBars
	self.UIGrids = form.UIGrids
	self.UITables = form.UITables
	self.UIScrollViews = form.UIScrollViews
	self.UIScrollBars = form.UIScrollBars
	self.PopupLists = form.PopupLists
	self.FormElements = form.FormElements
	self.Objects = form.Objects

	self:__OnInit(uiFormParams)
end

-- 获取组件
-- ======================================
function LuaNGUIForm:GetComponent( type )
	return self.form:GetComponent(type)
end

-- 播放音效
-- ======================================
function LuaNGUIForm:PlayUISound( id )
	self.form:PlayUISound(id)
end

-- 设置active
-- ======================================
function LuaNGUIForm:SetActive( active )
	self.form.gameObject:SetActive(active)
end

-- 获取sid
-- ======================================
function LuaNGUIForm:GetSid()
	return self.form.UIForm.SerialId
end

-- 关闭
-- ======================================
function LuaNGUIForm:Close()
	self.form:Close()
end

function LuaNGUIForm:__OnInit( uiFormParams )
	if self.OnInit then
		self:OnInit(uiFormParams)
	end
end

function LuaNGUIForm:__OnOpen( uiFormParams )
	self:SubscribeEvent(GT.StartChangeSceneEventArgs.EventId, handler(self, self.__OnStartChangeScene))
	self:SubscribeEvent(GT.ChangeSceneCompleteEventArgs.EventId, handler(self, self.__OnChangeSceneComplete))

	if self.OnOpen then
		self:OnOpen(uiFormParams)
	end
end

function LuaNGUIForm:__OnClose( uiFormParams )
	self:StopLogic()

	if self.OnClose then
		self:OnClose(uiFormParams)
	end
end

function LuaNGUIForm:__OnPause()
	if self.OnPause then
		self:OnPause()
	end
end

function LuaNGUIForm:__OnResume()
	if self.OnResume then
		self:OnResume()
	end
end

function LuaNGUIForm:__OnCover()
	if self.OnCover then
		self:OnCover()
	end
end

function LuaNGUIForm:__OnReveal()
	if self.OnReveal then
		self:OnReveal()
	end
end

function LuaNGUIForm:__OnRefocus( uiFormParams )
	if self.OnRefocus then
		self:OnRefocus(uiFormParams)
	end
end

function LuaNGUIForm:__OnDepthChanged( uiGroupDepth, depthInUIGroup )
	if self.OnDepthChanged then
		self:OnDepthChanged(uiGroupDepth, depthInUIGroup)
	end
end

function LuaNGUIForm:__OnClick( gameObject )
	if self.OnClick then
		self:OnClick(gameObject)
	end
end

function LuaNGUIForm:__OnToggle( gameObject )
	if self.OnToggle then
		self:OnToggle(gameObject)
	end
end

function LuaNGUIForm:__OnInputChange( gameObject )
	if self.OnInputChange then
		self:OnInputChange(gameObject)
	end
end

function LuaNGUIForm:__OnPress( gameObject )
	if self.OnPress then
		self:OnPress(gameObject)
	end
end

function LuaNGUIForm:__OnRelease( gameObject )
	if self.OnRelease then
		self:OnRelease(gameObject)
	end
end

function LuaNGUIForm:__OnDragOver( gameObject )
	if self.OnDragOver then
		self:OnDragOver(gameObject)
	end
end

function LuaNGUIForm:__OnDragOut( gameObject )
	if self.OnDragOut then
		self:OnDragOut(gameObject)
	end
end

function LuaNGUIForm:__OnEvent(userData)
	if self.OnEvent then
		self:OnEvent(userData)
	end
end

function LuaNGUIForm:__OnDestroy()
	if self.OnDestroy then
		self:OnDestroy(gameObject)
	end
end

function LuaNGUIForm:__OnStartChangeScene( sender, event )
	if self.OnStartChangeScene then
		self:OnStartChangeScene(sender, event)
	end
end

function LuaNGUIForm:__OnChangeSceneComplete( sender, event )
	if self.OnChangeSceneComplete then
		self:OnChangeSceneComplete(sender, event)
	end
end

return LuaNGUIForm